package com.example.demo.pattern.state;

import org.springframework.stereotype.Component;

/**
 * @program: demo
 * @description: 状态维护类
 * @author: yby
 * @create: 2020-06-22 16:00
 **/
@Component
public class StateContext {

    private OrderState orderState;

    /*StateContext(OrderState orderState){
        this.orderState = orderState;
    }*/
    public void setOrderState(OrderState orderState) {
        this.orderState = orderState;
    }

    public void switchState() {
         orderState.handle();
    }
}
